package com.kedacom.freedomLabel.initdata.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;


import com.kedacom.freedomLabel.initdata.bean.Staff;
import com.kedacom.freedomLabel.initdata.bean.Team;
import com.kedacom.freedomLabel.model.db.dao.IDao;

import java.util.List;

/**
 * Created by yao on 2021/3/23.
 * Describe
 */
@Dao
public interface StaffDao  extends IDao<Staff> {


    @Override
    @Query("SELECT COUNT(0) FROM Staff")
    int count();

    @Override
    @Update
    void update(Staff data);

    @Override
    @Insert(onConflict = OnConflictStrategy.FAIL)
    long save(Staff data);

    @Override
    @Insert(onConflict = OnConflictStrategy.FAIL)
    long[] save(List<Staff> data);

    @Override
    @Query("SELECT * FROM Staff ORDER BY staffId DESC")
    List<Staff> get();

    @Override
    @Query("SELECT * FROM Staff WHERE staffName LIKE   '%' || :param || '%'")
    List<Staff> get(String param);

    @Override
    @Query("SELECT * FROM Staff WHERE staffName=:param1 and staffName LIKE :param2")
    List<Staff> get(String param1, String param2);

    @Override
    @Delete
    void delete(Staff data);

    @Override
    @Query("DELETE FROM Staff")
    void delete();

    @Override
    @Query("DELETE FROM Staff WHERE staffName=:param ")
    void delete(String param);


//    @Query("SELECT * FROM Staff")
//    List<Staff> getAllStaff();
//
//    @Query("SELECT * FROM Staff WHERE staffId=:staffId")
//    Staff getAllStaffBystaffId(String staffId);
//
//    @Insert
//    void insert(List<Staff> staffList);
//
//    @Delete
//    void delete(List<Staff> staffList);
}
